import { FormProps, FormSchema } from '@/components/Table';
import { BasicColumn } from '@/components/Table/src/types/table';

export function getBasicColumns(): BasicColumn[] {
  return [
    {
      title: '客户名称',
      dataIndex: 'memberName',
    },
    {
      title: '购买订单号',
      dataIndex: 'orderId',
    },
    {
      title: '购买渠道',
      dataIndex: 'channel',
    },
    {
      title: '设备名称',
      dataIndex: 'device',
    },
    {
      title: '设备型号',
      dataIndex: 'deviceModel',
    },
    {
      title: '新客户',
      dataIndex: 'recordType',
    },
    {
      title: '第一次服务日期',
      dataIndex: 'firstFollowUpDate',
    },
    {
      title: '第一次服务记录',
      dataIndex: 'firstFollowUp',
    },
    {
      title: '第二次服务日期',
      dataIndex: 'secondFollowUpDate',
    },
    {
      title: '第二次服务记录',
      dataIndex: 'secondFollowUp',
    },
    {
      title: '第三次服务日期',
      dataIndex: 'thirdFollowUpDate',
    },
    {
      title: '第三次服务记录',
      dataIndex: 'thirdFollowUp',
    },
    {
      title: '售后工程师',
      dataIndex: 'afterSalesEngineer',
    },
    {
      title: '金额',
      dataIndex: 'money',
    },
    {
      title: '操作人',
      dataIndex: 'operator',
    },
  ];
}

export const schemas: FormSchema[] = [
  {
    field: 'memberName',
    component: 'Input',
    label: '客户名称',
    colProps: {
      span: 12,
    },
    required: true,
  },
  {
    field: 'afterSalesEngineer',
    component: 'Input',
    label: '售后工程师',
    colProps: {
      span: 12,
    },
    required: true,
  },
  {
    field: 'device',
    component: 'Input',
    label: '设备名称',
    colProps: {
      span: 12,
    },
    required: true,
  },
  {
    field: 'deviceModel',
    component: 'Input',
    label: '设备型号',
    colProps: {
      span: 12,
    },
    required: true,
  },
  {
    field: 'firstFollowUpDate',
    component: 'DatePicker',
    label: '第一次服务日期',
    colProps: {
      span: 12,
    },
    required: true,
  },
  {
    field: 'firstFollowUp',
    component: 'Input',
    label: '第一次服务记录',
    colProps: {
      span: 12,
    },
    required: false,
  },
  {
    field: 'secondFollowUpDate',
    component: 'DatePicker',
    label: '第二次服务日期',
    colProps: {
      span: 12,
    },
    required: true,
  },
  {
    field: 'secondFollowUp',
    component: 'Input',
    label: '第二次服务记录',
    colProps: {
      span: 12,
    },
    required: false,
  },
  {
    field: 'thirdFollowUpDate',
    component: 'DatePicker',
    label: '第三次服务日期',
    colProps: {
      span: 12,
    },
    required: true,
  },
  {
    field: 'thirdFollowUp',
    component: 'Input',
    label: '第三次服务记录',
    colProps: {
      span: 12,
    },
    required: false,
  },
  {
    field: 'orderId',
    component: 'InputNumber',
    label: '购买单号',
    colProps: {
      span: 12,
    },
    required: false,
  },
  {
    field: 'channel',
    component: 'Input',
    label: '购买渠道',
    colProps: {
      span: 12,
    },
    required: false,
  },
  {
    field: 'money',
    component: 'InputNumber',
    label: '金额',
    colProps: {
      span: 12,
    },
    required: false,
  },
];
export function getFormConfig(): Partial<FormProps> {
  return {
    labelWidth: 120,
    autoAdvancedLine: 4,
    schemas: [
      {
        field: 'afterSalesEngineer',
        component: 'Input',
        label: '售后工程师',
        colProps: {
          span: 6,
        },
      },
      {
        field: 'device',
        component: 'Input',
        label: '设备名称',
        colProps: {
          span: 6,
        },
      },
      {
        field: 'deviceModel',
        component: 'Input',
        label: '设备型号',
        colProps: {
          span: 6,
        },
      },
      {
        field: 'orderId',
        component: 'InputNumber',
        label: '购买单号',
        colProps: {
          span: 6,
        },
      },
      {
        field: 'channel',
        component: 'Input',
        label: '购买渠道',
        colProps: {
          span: 6,
        },
      },
    ],
  };
}
